package display;
/**
 *@author Lei
 */

import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.util.Iterator;
import java.util.Vector;



import storage.SongObject;

public class MPlayer {
	
	public static void main(String [] args){
		try {
			Registry registry = LocateRegistry.getRegistry();
			String[] registryComponents = registry.list();
			for(int i=0;i<registryComponents.length;i++){
				System.out.println("Service Name: "+registryComponents[i]);
			}
			try {
				storage.RMIServer storage=(storage.RMIServer) registry.lookup("storage1");
				Vector<SongObject> list=storage.getSongs();
				Iterator i=list.iterator();
				while(i.hasNext()){
					System.out.println(i.next().toString());
				}
				
			} catch (NotBoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		} catch (RemoteException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
